
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="com.entity.Permission"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>layout 管理系统大布局 - Layui</title>
  <link rel="stylesheet" href="add/layui/css/layui.css">
  <script type="text/javascript" src="add/layui/layui.js"></script>
  <script type="text/javascript" src="add/js/jquery-1.12.4.min.js"></script>
  <style type="text/css">
  	body {
	background-image: url(img/bing.jpg.jpg)
}
  </style>
</head>
<body>

  
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="height:668px; width: 100%">
    <div id="a" style="display: none;">		<!-- 把按钮从数据库里面提取出来 -->
    	<button TYPE='button' class='layui-btn layui-btn-normal' lay-event="upUser"><i class='layui-icon'>&#xe642;</i>更改用户</button>
<button TYPE='button'class='layui-btn layui-btn-warm xz' lay-event="addUser"><i class='layui-icon'>&#xe654;</i>新增用户</button>
    	<button TYPE='button' lay-event="delUser" class='layui-btn layui-btn-danger xz'><i class='layui-icon'>&#xe640;</i>删除用户</button>
    </div>
    	<table class="layui-table" id="test" lay-filter="test"></table>
    	<!-- <iframe name="kk" id="kk" src="" frambordder="0" height="100%"  width= "100%" scrolling=""></iframe> -->
    </div>
  </div>



<script type="text/javascript">
  layui.use('table', function(){
  var table = layui.table;
  table.render({
    elem: '#test'
    ,toolbar:'#a'
    ,cellMinWidth: 100
    ,url:'getAll'
    ,page: true
    ,cols: [[
      {type:'checkbox'}
      ,{field:'id', title: 'ID', sort: true}
      ,{field:'name', title: '用户名'}
      ,{field:'loginName', title: '登录名'}
      ,{field:'password', title: '密码'}
    ]]
  });
  table.on('toolbar(test)', function(obj){
	  var checkStatus = table.checkStatus(obj.config.id);
	  var data = checkStatus.data;
	  switch(obj.event){
	    case 'addUser':
	    	layer.open({
				title : "添加用户",
				type : 2,
				area:['400px', '680px'],
				content : "tianjia.jsp"
			})
	    break;
	    case 'delUser':
			var id=data[0].id;
		    if(data.length!=1){
		    	layer.msg('请选择一行');
		    	break;
		    }
		     $.post("getdelete.ss?id="+id+"","",function(data){
			if(data>0){
			
				layer.msg('删除成功');
				parent.location.reload();
			} 
			})
		break;
	    case 'upUser':
	    	layer.open({
				title : "修改用户",
				type : 2,
				area:['400px', '680px'],
				content : "xiugai.jsp"
			})
	    break;
	    case 'hairMenu':
	    	hair(id);
	    break;
	  };
	});
  })

</script>
<script>
//JS 
layui.use(['element', 'layer', 'util'], function(){
  var element = layui.element
  ,layer = layui.layer
  ,util = layui.util
  ,$ = layui.$;
  
});
</script>
</body>
</html>
